/**
 * 
 */
package com.thinkgsp.jxc.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.thinkgsp.util.XlsFieldAnnotation;
import com.thinkgsp.util.XlsFieldAnnotation;

/**
 * 产品分类表
 * @author evan
 *
 */
public class ProductClassify extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1135309323776246475L;

	/**
	 * 分类ID
	 */
	private Integer classifyId;
	/**
	 * 上级ID
	 */
	private Integer parentId;
	/**
	 * 分类名称
	 */
	@XlsFieldAnnotation(ChsName="产品分类",MethodName="getClassifyName")
	private String classifyName;
	
	/**
	 * 子分类
	 */
	private List<ProductClassify> childs = new ArrayList<ProductClassify>();
	
	/**
	 * 获取所有子分类
	 * @return
	 */
	public List<ProductClassify> getChilds() {
		return childs;
	}

	public void setChilds(List<ProductClassify> childs) {
		this.childs = childs;
	}

	/**
	 * 分类ID
	 * @return
	 */
	public Integer getClassifyId() {
		return classifyId;
	}

	public void setClassifyId(Integer classifyId) {
		this.classifyId = classifyId;
	}

	/**
	 * 上级ID
	 * @return
	 */
	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	/**
	 * 分类名称
	 * @return
	 */
	public String getClassifyName() {
		return classifyName;
	}

	public void setClassifyName(String classifyName) {
		this.classifyName = classifyName;
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#toString()
	 */
	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("classifyId",this.classifyId)
		  .append("parentId",this.parentId)
		  .append("classifyName",this.classifyName);
		
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof ProductClassify)) {
			return false;
		}
		final ProductClassify pc = (ProductClassify)o;
		if(classifyId != null) {
			return classifyId.equals(pc.getClassifyId());
		} else {
			return pc.getClassifyId() == null;
		}
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#hashCode()
	 */
	@Override
	public int hashCode() {
		return (this.classifyId != null ? this.classifyId.hashCode() : 0);
	}

}
